# 打开文件
f = open(r'C:\Users\Administrator\Desktop\1113.txt', encoding='utf-8')
print(f)
# 使用with open 方式打开
with open(r'C:\Users\Administrator\Desktop\1113.txt', encoding='utf-8') as file:
    text = file.read()
    print(text)

# 写文件write
data = 'hello world'
f1 = open('444.txt', 'w', encoding='utf-8')
f1.write('hellooween, helloween')
f1.close()

# 打开文件用于写入，如果文件不存在将会被创建
with open('333.txt', 'a', encoding='utf-8') as file:
    file.write(data)
